import React, { useEffect } from 'react';
import { useState } from 'react';
import { useRef } from 'react';
import SparkMD5 from 'spark-md5';
import { beforeFragmentation, fragmentation } from '@/apis/upload';
import STreeList from '@/conponents/sTreeList/index.jsx';
import { Button } from 'antd';
import { useRequest } from 'ahooks';
import { upload } from '@/apis/common';
import { meinvVideo } from '@/apis/upload';
import { useDispatch } from 'react-redux';
import { get } from '@/store/counterSlice';
const index = () => {
  const video = useRef(null);
  const dispatch = useDispatch();
  const getMeiNvVideo = async () => {
    const { payload } = await dispatch(get(meinvVideo()));
    video.current.src = payload.data;
    video.current.width = video.current.parentElement.clientWidth;
    video.current.play();
  };

  const { loading, run } = useRequest(getMeiNvVideo, {
    manual: true,
  });

  useEffect(() => {
    run();
  }, []);

  return (
    <>
      <div className="w-[393px] h-[852px] flex items-cente bg-black">
        <video autoPlay ref={video} muted loop></video>
      </div>
    </>
  );
};
export default index;
